package leetcode.code1200;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import leetcode.IDebug;

public class Solution implements IDebug {

	public List<List<Integer>> minimumAbsDifference(int[] arr) {
		Arrays.sort(arr);
		int d = Integer.MAX_VALUE;
		List<List<Integer>> ans = new ArrayList<>();
		for (int i = 1; i < arr.length; i++) {
			int cur = arr[i] - arr[i - 1];
			if (cur < d || cur == d) {
				if (cur < d) {
					ans = new ArrayList<>();
					d = cur;
				}
				List<Integer> nums = new ArrayList<>();
				nums.add(arr[i - 1]);
				nums.add(arr[i]);
				ans.add(nums);
			}
		}
		return ans;
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
